package com.ruicar.afs.cloud.basic.common.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ruicar.afs.cloud.basic.api.corporate.dto.CorporateTransferApprovedDTO;
import com.ruicar.afs.cloud.basic.api.corporate.dto.DealCorporateResultDto;
import com.ruicar.afs.cloud.basic.common.condition.ReceiptRecordCondition;
import com.ruicar.afs.cloud.basic.common.entity.BasicReceiptDealDetails;
import com.ruicar.afs.cloud.basic.common.entity.BasicReceiptRecord;
import com.ruicar.afs.cloud.basic.proceeds.debit.entity.BasicDebitBatchDetails;
import com.ruicar.afs.cloud.batch.entity.AfsBatchInfo;
import com.ruicar.afs.cloud.common.core.util.IResponse;
import com.ruicar.afs.cloud.common.modules.contract.enums.ReceiptSourceTypeEnum;
import com.ruicar.afs.cloud.common.modules.contract.enums.TransOpreateTypeEnums;
import com.ruicar.afs.cloud.common.modules.contract.enums.WriteTargetTypeEnum;
import com.ruicar.afs.cloud.common.mq.finance.debit.dto.StartReceiptHandleDto;
import com.ruicar.afs.cloud.common.vo.BasicReceiptRecordVo;
import com.ruicar.afs.cloud.common.vo.CollectCancelVo;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Date;
import java.util.List;

/**
 * @author: Lee
 * @date 2020-05-30 04:34:35
 * @description
 */
public interface BasicReceiptRecordService extends IService<BasicReceiptRecord> {


    /**
     * 针对代扣成功进行收据初始化
     * @author ZC.GUO
     * @param debitBatchDetails 扣款成功记录
     * @param writeTarget 核销目的
     * @return
     */
    public BasicReceiptRecord initReceiptRecordOfDebit(BasicDebitBatchDetails debitBatchDetails, WriteTargetTypeEnum writeTarget,Date batchDate);

    /**
     * 收据初始化成功发送mq
     * @author ZC.GUO
     * @param basicReceiptRecord 收据
     * @param operateType 操作类型
     * @param buriedPointNo 埋点编号
     * @param operator 操作人
     * @return
     */
    public void sendDebitSuccessDataToFinance(BasicReceiptRecord basicReceiptRecord, TransOpreateTypeEnums operateType, String buriedPointNo, String operator);

    /**
     * 针对对公结算通过进行收据初始化
     * @author ZC.GUO
     * @param corporateTransferApprovedDTO 对公结算成功数据集合
     * @return
     */
    public List<BasicReceiptRecord> initReceiptRecordOfCorporateTransfer(CorporateTransferApprovedDTO corporateTransferApprovedDTO,Date batchDate);

    /**
     * 对公结算审核通过处理
     * @author ZC.GUO
     * @param
     * @return
     */
    public IResponse<DealCorporateResultDto> corporateTransferApproved(@RequestBody CorporateTransferApprovedDTO corporateTransferApprovedDTO,Date batchDate);
    /**
     * 针对收据入账失败进行处理
     * @author ZC.GUO
     * @param message 失败信息
     * @return
     */
    public boolean arriveSuccessErrorHandle(String message);
    /**
     * 针对收据入账失败进行处理
     * @author ZC.GUO
     * @param message 失败信息
     * @return
     */
    public boolean receiptHandleCompleteErrorHandle(String message);


    /**
     * 对指定的收据进行处理
     * @author ZC.GUO
     * @param startReceiptHandleDto 指定收据id集合
     * @return
     */
    public boolean handleReceiptByIdList(StartReceiptHandleDto startReceiptHandleDto,Date batchDate);


    /**
     * 收据处理(正常核销)
     * @author ZC.GUO
     * @param receiptRecord
     * @return
     */
    public List<BasicReceiptDealDetails> handleReceiptForNormal(BasicReceiptRecord receiptRecord, Date batchDate);
    /**
     * 收据处理(提前还款核销)
     * @author ZC.GUO
     * @param receiptRecord
     * @return
     */
    public List<BasicReceiptDealDetails> handleReceiptForBeforeCharge(BasicReceiptRecord receiptRecord,Date batchDate);


    /**
     *  退款收款通过进行收据处理
     * @author ZC.GUO
     * @param id 撤销收款通过的收据id
     * @param operator 操作人用户名
     * @return
     */
    public boolean handleReceiptForRefund(Long id, String operator);

    /**
     *  撤销收款通过进行收据处理
     * @author ZC.GUO
     * @param id 撤销收款通过的收据id
     * @param operator 操作人用户名
     * @return
     */
    public IResponse handleReceiptForCancel(Long id, String operator, AfsBatchInfo afsBatchInfo,Date batchDate);

    public BasicReceiptRecordVo getReceiptRecordInfo(String contractNo, Long receiptId);

    public List<CollectCancelVo> getReceiptRecord(ReceiptRecordCondition condition);

    public CollectCancelVo getCollectCancelVo(Long id);

    void handleIncome(Long receiptId, ReceiptSourceTypeEnum sourceType);

    void sendcontractClose();
}
